<template>
	<view class="afterSale">
		<view class="title">
			<image src="/pagesB/static/tip_tuihuo@2x.png" mode=""></image>
			<view class="title1">快递至肥猫仓</view>
			<view class="title2">地址：浙江省金华市婺城区新业街299号</view>
		</view>
		<view class="order_title">
			<view class="title_left">快递公司</view>
			        <xfl-select 
			            :list="list"
			            :clearable="false"
			            :showItemNum="5" 
			            :listShow="true"
			            :isCanInput="true"  
			            :style_Container="'height: 44rpx; flex: 1;'"
			            :placeholder = "'请选择'"
			            :selectHideType="'hideAll'"
			        >
			        </xfl-select>
		</view>

		<view class="order_title">
			<view class="title_left">快递单号</view>
			<input type="text" v-model="id" placeholder="请输入" />
		</view>
		
		<view class="voucher">
			<view class="voucher_title">
				上传凭证
			</view>
			<view class="voucher_content">
				<image v-if="img != ''"  v-for="i in img" :key="i" :src="'http://'+i" class="sctu"></image>
				<view class="jia" @click="shangchuan">
					+
				</view>
			</view>
		</view>
		<view class="button">
			<button type="warn" @click="addmanagement">保存</button>
		</view>
	</view>
</template>

<script>
	import uniCombox from "@/components/uni-combox/uni-combox"
	import xflSelect from '@/components/xfl-select/xfl-select.vue';  
	export default {
		components: {uniCombox,xflSelect},
		data() {
			return {
				img:'',
				id:'',
				goods:[],
				list: [],
			};
		},
		onShow() {
			this.goods = JSON.parse(uni.getStorageSync('goods'));
			this.$request('/app/order/getExpress','post',{
			}).then(res=>{
				res.content.forEach(v=>{
					v.value=v.express_name
				})
				this.list=res.content
				console.log(this.list)
			})
		},
		methods:{
			shangchuan(){
				let _this=this
				uni.chooseImage({
					count: 9, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album', 'camera'], //从相册选择
					success: (res1) => {
						this.$UploadImg(res1.tempFilePaths[0],_this.Url.token).then(res=>{
							_this.img.push(res.imageURL)
						})
					}
				});
			},
			addmanagement(){
				this.$request('/app/order/refund','post',{
					access_token:uni.getStorageSync('access_token').replace(/^\"|\"$/g,''),
					type:'2',
					// linkman:this.name,
					// linkphone:this.phone,
					// account:this.zfb,
					// name:this.payee,
					images:this.goods.img,
					money:this.goods.money,
					reason:this.goods.reason,
					option_id:this.goods.option_id,
					goods_id:this.goods.goods_id,
					order_sn:JSON.parse(uni.getStorageSync('order_sn'))
				}).then(res=>{
					uni.showToast({
						title:res.message
					})
					if(res.errcode==0){
						uni.navigateBack({
							delta:2
						})
					}
				})
			}
		}
	}
</script>

<style lang="less">
	.afterSale{
		height: 100%;
		background: #F3F4F5;
		padding-top: 20rpx;
		.title{
			background-color: #fff;
			display: flex;
			align-items: center;
			flex-direction: column;
			margin-bottom: 20rpx;
			padding: 60rpx 0;
			image{
				width: 430rpx;
				height: 170rpx;
			}
			.title1{
				font-size: 32rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #111111;
				padding-top: 40rpx;
				padding-bottom: 20rpx;
			}
			.title2{
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #111111;
			}
		}
		.voucher{
			padding: 30rpx;
			background-color: #fff;
			border-bottom: 1px solid #eeeeee;
			.voucher_title{
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #111111;
			}
			.voucher_content{
				display: flex;
				margin: auto;
				margin-top: 20px;
			}
			.sctu{
				width:80px;
				height:80px;
				margin-right: 15px;
			}
			.jia{
				width:80px;
				height:80px;
				background-color:#C8C7CC;
				color:#808080;
				text-align: center;
				line-height: 80px;
				font-size: 30px;
				font-weight: 700;
			}
		}
		.order_title {
			display: flex;
			padding: 30rpx;
			border-bottom: 1px solid #eeeeee;
			background-size: 28rpx 28rpx;
			background-color: #fff;
			xfl-select{
				flex: 1;
				.show-box{
					border: 0;
				}
			}
			.title_left {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #111111;
				margin-right: 30rpx;
			}
			input{
				flex: 1;
				font-size: 28rpx;
			}
		}
		.button {
				width: 90%;
				margin: 0 auto;
				padding: 40rpx 0;
				button{
					border-radius: 20px;
					line-height: 80rpx;
				}
			}
	}
</style>
